import request from '@/utils/request'

export default {
  /**
   * 添加车次
   * @param data
   * @returns {AxiosPromise}
   */
  addTransportTrips(data) {
    return request({
      url: `/base/goods/pd-transport-trips`,
      method: 'post',
      data: data
    })
  },
  /**
   * 获取车次列表
   * @returns {AxiosPromise}
   */
  getTransportTrips() {
    return request({
      url: `/base/goods/pd-transport-trips`,
      method: 'get'
    })
  },
  /**
   * 获取车次和车辆司机的列表
   * @param id
   * @returns {*}
   */
  findAllTruckDriverTransportTrips(id) {
    return request({
      url: `/base/goods/pd-transport-trips/truckDriver`,
      method: 'get',
      params: {
        'transportTripsId': id
      }
    })
  },
  findTransportTripsById(id) {
    return request({
      url: `/base/goods/pd-transport-trips/${id}`,
      method: 'get'
    })
  },
  /**
   * 批量保存车次与车辆和司机关联关系
   * @param id
   * @param data
   * @returns {AxiosPromise}
   */
  add(id, data) {
    return request({
      url: `/base/goods/pd-transport-trips/${id}/truckDriver`,
      method: 'post',
      data: data
    })
  }
}
